//
//  HMPictureViewCell.m
//  SinaWeiBo
//
//  Created by WGP on 16/4/16.
//  Copyright © 2016年 WGP. All rights reserved.
//

#import "HMPictureViewCell.h"

@interface HMPictureViewCell ()

@property(nonatomic,strong)UIImageView *bgImageView;

@end

@implementation HMPictureViewCell

-(instancetype)initWithFrame:(CGRect)frame
{
    if(self = [super initWithFrame:frame])
    {
        [self setupUI];
    }
    return self;
}


-(instancetype)initWithCoder:(NSCoder *)aDecoder
{
    if(self = [super initWithCoder:aDecoder])
    {
        [self setupUI];
    }
    return  self;
}

-(void)setupUI
{
//    1.添加控件
    self.bgImageView = [[UIImageView alloc] init];
    [self.contentView addSubview:self.bgImageView];
    
//    设置填充模式
    self.bgImageView.contentMode = UIViewContentModeScaleAspectFill;
    self.bgImageView.clipsToBounds = YES;
    
//    2.添加约束
    [self.bgImageView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.edges.equalTo(self.contentView);
    }];
}


-(void)setImageURL:(NSURL *)imageURL
{
    _imageURL = imageURL;
    
    [self.bgImageView sd_setImageWithURL:imageURL];
}

@end
